home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
tlx_sq15.zip
/
PCBREG.SLT
< prev
next >
Wrap
Text File
|
1990-10-12
|
10KB
|
305 lines
//-----------------------------------------------------------
// PCBREG.SL? Automatic registration to a new MBBS.
//
// Please look at the comments through the whole file, and modify to
// suit your needs before you use it. Then recompile with CS PCBREG.
//-----------------------------------------------------------
str thisBBStype[]="PCB" // Works only for PCBoard.
,line [80] // Line for string storage.
,help [20] // Line for string storage.
// For the Global storage:
,global []="GLOBAL" // Global script.
,bbstype []="BTYPE" // BBS type.
,hisprot []="HPROT" // BBS's protocol characters.
,passw []="PASSW" // Current password.
,addr []="ADDR" // Address
,mail []="MAIL" // Mail address
,state []="STATE" // Country
,htel []="HTEL" // Home phone
,wtel []="WTEL" // Work phone
,cpu []="CPU" // Computer model
;
int tol = 300 // No activity for ½ minute
,stat, tmark // gives automatic exit.
,i, norsk = 0
;
//-----------------------------------------------------------
// Script starts here.
//-----------------------------------------------------------
main()
{
int error;
entry(); // Updates colors & status bar.
call (global,"R",bbstype,line); // Get BBS type. Should be MBBS.
if (line != thisBBStype)
{ wrongBBS();
return (-1);
}
// Only if online.
if (!carrier())
{ alarm(1);
status_wind ("THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
return (0);
}
// Start tracking incoming text. For ease of reading and programming,
// and to improve the speed of the program on slow computers, this is
// split into different sections.
//-----------------------------------------------------------
cputs ("C^M"); // Continue registration.
if (waitfor ("register with us",10))
cputs ("Y^M");
else
{ cputs ("n^M");
return (-1);
}
error = 0;
SECTION1(); // These set error = -1
// by failure.
release(); // Free timer and tracks.
if (error < 0) goto fail;
SECTION2();
release();
if (!error)
{ if (waitfor ("Command?",180)) // Command?
{ cputs ("X^M"); // Set Xpert mode.
waitfor ("Command?",10); // Wait for next command.
}
goto done; // Return to caller.
}
fail:
status_wind ("Registration failed!",20);
error = -1;
done:
return (error);
}
//-----------------------------------------------------------
// Start registration.
//-----------------------------------------------------------
SECTION1()
{
int c, error;
// Variables ysed for text tracking:
int pw // Password
,mo1, mo2 // More?
,mo3, mo4 // (answer NO to these four prompts)
,pro
,ma // Mail address
,ci // City calling from
,cs // City and state calling from
;
error = -1;
mo1= track ("(NS)non-stop?",0); // More?
mo2= track ("(H)elp, More?",0);
mo3= track ("each message?",0);
mo4= track ("Message Base ",0); // Scan message base?
pro= track ("Protocol Desi",0); // Default protocol desired
pw = track ("password",1); // Password
ma = track ("dress?",0); // Mail address
cs = track ("State calling",0); // City and state calling from?
ci = track ("City calling", 0); // City calling from?
tmark = timer_start (tol); // wait up to 1 minute for
// each response.
while ((stat=trig()) > 0) // answer any questions.
{ if (stat == pw) // Password
output (passw);
else if (stat==mo1 || stat==mo2 // More?
|| stat==mo3 || stat==mo4)
cputs ("n^M"); // Not now please.
else if (stat == pro) // Default protocol
output (hisprot);
else if (stat == ma) // Mail address
output (addr);
if ((stat==ci) || (stat==cs)) // City (and state)?
{ call (global,"R",mail,line);
for (i=0; i<strlen (line); ++i)
{ c=subchr (line,i); // Extract postnr. from string.
if (!isdigit(c) && c!=' ') break;
}
subchrs (line,i,20-i,help);
cputs (help); // give city.
if (stat == cs)
{ cputs (" "); // Give country.
output (state);
}
else
cputs ("^M"); // CR.
error = 0;
break; // This section done.
}
}
return (error); // Good or bad.
}
//-----------------------------------------------------------
// Section 2 of registration.
//-----------------------------------------------------------
SECTION2()
{
int error;
// Variables used for text tracking:
int pw // Please wait...
,mo1, mo2 // More?
,en // Press (Enter) to continue:
,hp // Home phone
,wp // Work phone
,bc1, bc2 // Brand of CPU
;
error = -1; // Start new trackings.
wp = track ("data phone #",0); // Business or data phone
hp = track ("oice phone #",0); // Home or voice phone
en = track (" to continue",0); // ENTER to continue.
pw = track ("Please Wait ",0); // Please wait.
mo1 = track ("(NS)non-stop?",0); // More?
mo2 = track ("Message Base ",0); // Scan message base?
bc1 = track ("CPU ",0); // Brand of CPU in use.
bc2 = track ("Computer ",1);
tmark = timer_start (tol); // wait up to 1 minute for
// each response.
while ((stat=trig()) > 0) // answer any questions.
{ if (stat==mo1 || stat==mo2) // More?
cputs ("N^M"); // Not now please.
else if (stat == en) // ENTER to continue
cputs ("^M");
else if (stat == hp) // Home phone number
output (htel);
else if (stat == wp) // Work phone number
output (wtel);
else if (stat==bc1 || stat==bc2) // CPU type?
output (cpu);
else if (stat == pw) // Please wait...
{ error = 0;
break;
}
}
return (error);
}
//-----------------------------------------------------------
// Wrong BBS type.
//-----------------------------------------------------------
wrongBBS()
{
str help[48];
failtone(); // Alarm.
help = "This script is for "; // Catenate strings.
strcat (help,thisBBStype);
strcat (help," only!");
status_wind (help,20); // Display message for 2 sec.
}
//-----------------------------------------------------------
// Play fail tone.
//-----------------------------------------------------------
failtone()
{
int n;
for (n=140; n > 10; n = 100*n/120)
{ tone(n*10,12); // Fail tone!!
terminal(); // Process text.
}
}
//-----------------------------------------------------------
// Routine to update colors and status bar.
//-----------------------------------------------------------
entry ()
{
_back_color = 1;
_fore_color = 14;
update_term();
}
//-----------------------------------------------------------
// Free timer and tracking functions.
//-----------------------------------------------------------
release()
{
timer_free (tmark); // fr